export const defaultListColumns = [
  {
    width: '50',
    type: 'selection'
  },
  { width: '60px',
    type: 'index',
    label: '序号',
  },
  {
    width: '150',
    prop: 'factoryItemNum',
    label: '原厂产品编码'
  },
  {
    width: '150',
    prop: 'itemNum',
    label: '供应商产品编码'
  },
  {
    width: '300',
    prop: 'itemName',
    label: '产品名称（中）',
    'show-overflow-tooltip': true
  },
  {
    'min-width': '100',
    prop: 'specs',
    label: '规格',
    'show-overflow-tooltip': true
  },
  {
    'min-width': '100',
    prop: 'specs',
    label: '型号',
    'show-overflow-tooltip': true
  },
  {
    width: '100',
    prop: 'primaryUnitOfMeasureName',
    label: '单位'
  },
  {
    width: '100',
    prop: 'availableQuantity',
    label: '可用库存',
    formatter: row => setAvailableQuantityCount(row)
  },
  {
    width: '300',
    prop: 'manufacturerName',
    label: '生产厂家'
  },
  {
    width: '130',
    prop: 'productLineName',
    label: '产品线'
  },
  {
    'min-width': '100',
    prop: 'price',
    label: '参考单价（元）'
  }
];
let setAvailableQuantityCount = function(row) {
  let availableQuantityCount = 0
  let availableQuantityList = row.onhandQuantitiesVOList || []
  if (row.availableQuantity || row.availableQuantity === 0) {
    availableQuantityCount = row.availableQuantity * 10000
  } else {
    if (availableQuantityList.length === 0) {
      availableQuantityCount = '--'
      return availableQuantityCount
    }
    availableQuantityList.map(l => {
      availableQuantityCount += l.availableQuantity * 10000
    })
  }
  availableQuantityCount = (availableQuantityCount/10000).toFixed(4)
  return availableQuantityCount
}

